docs: add say_stream notes to the experiments page#1463
docs: add say_stream notes to the experiments page#1463lukegalbraithrussell wants to merge 4 commits intodocs-agent-kitfrom
Conversation
| "label": "Experiments", | ||
| "items": ["tools/bolt-python/experiments"] | ||
| }, | ||
| "tools/bolt-python/experiments", |
There was a problem hiding this comment.
this was my bad; should've been a page from the beginning
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## docs-agent-kit #1463 +/- ##
==================================================
- Coverage 91.43% 91.31% -0.12%
==================================================
Files 232 229 -3
Lines 7340 7266 -74
==================================================
- Hits 6711 6635 -76
- Misses 629 631 +2 ☔ View full report in Codecov by Sentry. |
|
|
6048885 to
422c62f
Compare
@zimeg I reset the branch to just be docs changes! |
WilliamBergamin
left a comment
There was a problem hiding this comment.
Awesome work on this 🥇 Wasn't sure how to frame all this but this is spot on
docs/english/experiments.md
Outdated
|
|
||
| ## `say_stream` utility {#say-stream} | ||
|
|
||
| The `say_stream` utility is a listener argument available on `app.event` and `app.message` listeners. |
docs/english/experiments.md
Outdated
| | `recipient_team_id` | Sourced from the event `team_id` (`enterprise_id` if the app is installed on an org). | ||
| | `recipient_user_id` | Sourced from the `user_id` of the event. | ||
|
|
||
| If neither a `channel_id` or `thread_ts` can be sourced, then the utility will merely be `None`. |
docs/english/experiments.md
Outdated
| @app.message("") | ||
| def handle_message(client: WebClient, say_stream: SayStream): | ||
| stream = say_stream() | ||
|
|
There was a problem hiding this comment.
Nit: do we need this empty space?
srtaalej
left a comment
There was a problem hiding this comment.
looks really great luke! ⭐
| * [`chat_stopStream`](/reference/methods/chat.stopStream) | ||
|
|
||
| The Python Slack SDK provides a [`chat_stream()`](https://docs.slack.dev/tools/python-slack-sdk/reference/web/client.html#slack_sdk.web.client.WebClient.chat_stream) helper utility to streamline calling these methods. Here's an excerpt from our [Assistant template app](https://github.com/slack-samples/bolt-python-assistant-template): | ||
| Bolt for Python provides a `say_stream` listener argument available on `app.event` and `app.message` listeners. |
| | `recipient_team_id` | Sourced from the event `team_id` (`enterprise_id` if the app is installed on an org). | ||
| | `recipient_user_id` | Sourced from the `user_id` of the event. | ||
|
|
||
| If neither a `channel_id` or `thread_ts` can be sourced, then the utility will merely be `None`. |
There was a problem hiding this comment.
nit: i feel like this can be clearer
| If neither a `channel_id` or `thread_ts` can be sourced, then the utility will merely be `None`. | |
| If neither a `channel_id` or `thread_ts` can be sourced, then the utility will just be `None`. |
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Looking great! I've left a few minor suggestions but nothing is blocking.
| You can have your app's messages stream in to replicate conventional agent behavior. This is done through three Web API methods: | ||
|
|
||
| * [`chat_startStream`](/reference/methods/chat.startStream) | ||
| * [`chat_appendStream`](/reference/methods/chat.appendStream) | ||
| * [`chat_stopStream`](/reference/methods/chat.stopStream) |
There was a problem hiding this comment.
nit(non-blocking): Showing the 3 Web API methods to manually stream messages at the very top is a little confusing. Also, L54 mentions that say_stream uses this API under-the-hood and there's a nice callout at the bottom explaining how to manually use the Web API Streaming methods.
Could this sentence be merged with the next paragraph? For example:
You can have your app's messages stream in to replicate conventional agent behaviour. Bolt for Python provides a
say_streamutility is available onapp.eventandapp.messagelisteners.
| * [`chat_stopStream`](/reference/methods/chat.stopStream) | ||
|
|
||
| The Python Slack SDK provides a [`chat_stream()`](https://docs.slack.dev/tools/python-slack-sdk/reference/web/client.html#slack_sdk.web.client.WebClient.chat_stream) helper utility to streamline calling these methods. Here's an excerpt from our [Assistant template app](https://github.com/slack-samples/bolt-python-assistant-template): | ||
| Bolt for Python provides a `say_stream` listener argument available on `app.event` and `app.message` listeners. |
There was a problem hiding this comment.
suggestion: The current sentence is correct, but "argument" is often thought of as a simple variable or object. We use the term "utility" below, so maybe can clarify that say_stream is a utility provided as a listener argument.
| Bolt for Python provides a `say_stream` listener argument available on `app.event` and `app.message` listeners. | |
| Bolt for Python provides a `say_stream` utility as a listener argument for `app.event` and `app.message` listeners. |
| ### Limitations | ||
|
|
||
| The `chat_stream()` method currently only works when the `thread_ts` field is available in the event context (DMs and threaded replies). Top-level channel messages do not have a `thread_ts` field, and the `ts` field is not yet provided to `BoltAgent`. No newline at end of file | ||
| The `chat_stream()` method currently only works when the `thread_ts` field is available in the event context (DMs and threaded replies). Top-level channel messages do not have a `thread_ts` field, and the `ts` field is not yet provided to `BoltAgent`. |
There was a problem hiding this comment.
note: I believe we've fixed this issue so say_stream() is now available on top-level channel messages and uses the ts as the thread_ts value. We've also updated chat_stream() to be say_stream().
.cc @WilliamBergamin
Summary
This PR adds docs for the
say_streamhelper in the sending messages page. Picture is the preview:/tools/bolt-python/concepts/message-sending:Testing
Category
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
./scripts/install_all_and_run_tests.shafter making the changes.